$(document)
		.ready(
				function() {

					$
							.ajax({
								type : "post",
								url : "articleStudyList",
								async : true,
								dataType : 'json',
								success : function(data) {

									console.log(data)

									var articlePath = 'myAssets//img//article//';// 文章文件路径
									var facePath = 'myAssets//img//face//';// 头像文件路径

									var list = data.listVo;// 文章数组 
									for (var i = 0; i < list.length; i++) {

										var id = list[i].id;
										var type = list[i].type;// 类型
										var title = list[i].title;// 标题
										var content = list[i].content;// 内容
										var user = list[i].user;// 内容

										// 分享
										if (type == 'fenxiang') {
											type = '<div class="pet_list_tag pet_list_tag_zzs">分享</div>'
										}
										// 教学
										if (type == 'jiaoxue') {
											type = '<div class="pet_list_tag pet_list_tag_stj">教学</div>'
										}
										// 提问
										if (type == 'tiwen') {
											type = '<div class="pet_list_tag pet_list_tag_tiwen">提问</div>'
										}
										// 趣闻
										if (type == 'quwen') {
											type = '<div class="pet_list_tag pet_video_tag">趣闻</div>'
										}

										if (list[i].myFiles.length == 0) {
											$("#articel-List")
													.append(
															'<li class="am-g am-list-item-desced pet_list_one_block">  <div class="pet_list_one_info">  <div class="pet_list_one_info_l">      <div class="pet_list_one_info_ico"><a href="heUser?id='
																	+ user.id
																	+ '"><img src="'
																	+ facePath
																	+ user.myFile.name
																	+ '" alt=""></a></div>     <div class="pet_list_one_info_name">'
																	+ user.name
																	+ '</div>   </div>      <div class="pet_list_one_info_r">'
																	+ type
																	+ '</div>  </div>  <div class=" am-list-main">  <h3 class="am-list-item-hd pet_list_one_bt"><a href="articleStudyOne?id='
																	+ id
																	+ '" class="">'
																	+ title
																	+ '</a></h3>  <div class="am-list-item-text pet_list_two_text">'
																	+ content
																	+ '</div>  </div>  </li>');
										}
										if (list[i].myFiles.length == 1
												|| list[i].myFiles.length == 2) {
											$("#articel-List")
													.append(
															'<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-right pet_list_one_block" style="/*border:none;*/"> <div class="pet_list_one_info"> <div class="pet_list_one_info_l">   <div class="pet_list_one_info_ico"><a href="heUser?id='
																	+ user.id
																	+ '"><img src="'
																	+ facePath
																	+ user.myFile.name
																	+ '" alt=""></a></div> <div class="pet_list_one_info_name">'
																	+ user.name
																	+ '</div> </div>  <div class="pet_list_one_info_r">'
																	+ type
																	+ '</div> </div> <div class=" am-u-sm-8 am-list-main pet_list_one_nr"> <h3 class="am-list-item-hd pet_list_one_bt"><a href="articleStudyOne?id='
																	+ id
																	+ '" class="">'
																	+ title
																	+ '</a></h3> <div class="am-list-item-text pet_list_one_text01">'
																	+ content
																	+ '</div> </div>  <div class="am-u-sm-4 am-list-thumb">  <a href="articleStudyOne?id='
																	+ id
																	+ '" class="">  <img src="'
																	+ articlePath
																	+ list[i].myFiles[0].name
																	+ '" class="pet_list_one_img" alt=""/> </a>  </div> </li>');
										}
										if (list[i].myFiles.length >= 3) {
											$("#articel-List")
													.append(
															' <li class="am-g am-list-item-desced pet_list_one_block"> <div class="pet_list_one_info"><div class="pet_list_one_info_l"> <div class="pet_list_one_info_ico"><a href="heUser?id='
																	+ user.id
																	+ '"><img src="'
																	+ facePath
																	+ user.myFile.name
																	+ '" alt=""></a></div> <div class="pet_list_one_info_name">'
																	+ user.name
																	+ '</div> </div> <div class="pet_list_one_info_r">'
																	+ type
																	+ ' </div></div><div class=" am-list-main"> <h3 class="am-list-item-hd pet_list_one_bt"><a href="articleStudyOne?id='
																	+ id
																	+ '" class="">'
																	+ title
																	+ '</a></h3> <ul data-am-widget="gallery" class="am-gallery am-avg-sm-3 am-avg-md-3 am-avg-lg-3 am-gallery-default pet_list_one_list" ><li><div class="am-gallery-item"> <a href="articleStudyOne?id='
																	+ id
																	+ '" class=""> <img src="'
																	+ articlePath
																	+ list[i].myFiles[0].name
																	+ '"  alt=""/> </a> </div> </li> <li> <div class="am-gallery-item"> <a href="articleStudyOne?id='
																	+ id
																	+ '" class=""> <img src="'
																	+ articlePath
																	+ list[i].myFiles[1].name
																	+ '"  alt=""/> </a> </div> </li> <li><div class="am-gallery-item">  <a href="articleStudyOne?id='
																	+ id
																	+ '" class="">  <img src="'
																	+ articlePath
																	+ list[i].myFiles[2].name
																	+ '"  alt=""/> </a> </div>  </li> </ul> <div class="am-list-item-text pet_list_two_text">'
																	+ content
																	+ '</div> </div> </li>');
										}

									}
									$(document)
											.ready(
													function() {

														// 动态计算新闻列表文字样式
														auto_resize();
														$(window)
																.resize(
																		function() {
																			auto_resize();
																		});
														$('.am-list-thumb img')
																.load(
																		function() {
																			auto_resize();
																		});
														$(
																'.pet_article_like li:last-child')
																.css('border',
																		'none');
														function auto_resize() {
															$(
																	'.pet_list_one_nr')
																	.height(
																			$(
																					'.pet_list_one_img')
																					.height());
															// alert($('.pet_list_one_nr').height());
														}
														$('.pet_article_user')
																.on(
																		'click',
																		function() {
																			if ($(
																					'.pet_article_user_info_tab')
																					.hasClass(
																							'pet_article_user_info_tab_show')) {
																				$(
																						'.pet_article_user_info_tab')
																						.removeClass(
																								'pet_article_user_info_tab_show')
																						.addClass(
																								'pet_article_user_info_tab_cloes');
																			} else {
																				$(
																						'.pet_article_user_info_tab')
																						.removeClass(
																								'pet_article_user_info_tab_cloes')
																						.addClass(
																								'pet_article_user_info_tab_show');
																			}
																		});

														$('.pet_head_gd_ico')
																.on(
																		'click',
																		function() {
																			$(
																					'.pet_more_list')
																					.addClass(
																							'pet_more_list_show');
																		});
														$('.pet_more_close')
																.on(
																		'click',
																		function() {
																			$(
																					'.pet_more_list')
																					.removeClass(
																							'pet_more_list_show');
																		});
													});

									// console.log(CurentTime())
								},
								error : function() {
								}
							});

				})

// 获取当前时间方法
function CurentTime() {
	var now = new Date();
	var year = now.getFullYear(); // 年
	var month = now.getMonth() + 1; // 月
	var day = now.getDate(); // 日
	var hh = now.getHours(); // 时
	var mm = now.getMinutes(); // 分
	var clock = year + "-";
	if (month < 10)
		clock += "0";
	clock += month + "-";
	if (day < 10)
		clock += "0";
	clock += day + " ";
	if (hh < 10)
		clock += "0";
	clock += hh + ":";
	if (mm < 10)
		clock += '0';
	clock += mm;
	return (clock);
}
